//
//  ZYEmoticonBtn.swift
//  weiboZY
//
//  Created by 赵勇 on 16/5/22.
//  Copyright © 2016年 赵勇. All rights reserved.
//

import UIKit

class ZYEmoticonBtn: UIButton {

    var emoticon: ZYEmoticon? {
        
        didSet{
            guard let emot = emoticon else {
                return
            }
            
        if emot.type == "0" {
            self.setImage(UIImage(named: emot.path!), forState: .Normal)
            self.setTitle(nil, forState: .Normal)
        } else {
            self.setTitle((emot.code! as NSString).emoji(), forState: .Normal)
            self.titleLabel?.font = UIFont.systemFontOfSize(34)
            self.setImage(nil, forState: .Normal)
        }

            
        }
        
        
    }

}
